package com.sky.mapper;

import com.sky.entity.OrderDetail;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

@Mapper
public interface OrderDetailMapper {
    void insertBatch(List<OrderDetail> orderDetails);

    @Select("select * from order_detail where order_id = #{OrderId}")
    List<OrderDetail> queryByOrderId(Long OrderId);

    @Delete("delete from order_detail where order_id = #{orderId}")
    void deleteByOrderId(Long orderId);

    @Insert("insert into order_detail(name, image, dish_flavor, dish_id, order_id, number, amount)" +
            "values (#{name}, #{image}, #{dishFlavor}, #{dishId}, #{orderId}, #{number}, #{amount})")
    void insert(OrderDetail orderDetail);

    List<OrderDetail> getByOrderId(Long id);

    List<Double> salesnumberStatistics(LocalDate begin, LocalDate end);

    List<String> salesnameStatistics(LocalDate begin, LocalDate end);
}
